
/**
 * @fileoverview A simple story model implementation.
 * @author johannes.nel@gmail.com (Johan)
 * Date: 2012/03/25
 * Time: 10:00 AM
 */

goog.provide('lfpug.model.Story');
goog.require('lfpug.model.ArrayCollection');
goog.require('lfpug.model.BaseModel');
goog.require('lfpug.model.IDescriptiveModel');



/**
 * @constructor
 * @implements {lfpug.model.IDescriptiveModel}
 * @extends {lfpug.model.BaseModel}
 *
 * @param {string} id The unique id of this story.
 */
lfpug.model.Story = function(id) {
  goog.base(this, id);
  this.tasks_ = new lfpug.model.ArrayCollection();
  this.registerForBubbeling(this.tasks_);
};
goog.inherits(
    lfpug.model.Story,
    lfpug.model.BaseModel
);


/**
 * @override
 */
lfpug.model.Story.prototype.disposeInternal = function() {
  goog.base(this, 'disposeInternal');
  this.deregisterForBubbeling(this.tasks_);
  var tasksArr = this.tasks_.getSource();
  var i = tasksArr.length;
  while (i--) {
    tasksArr[i].dispose();
  }
  this.tasks_.dispose();
};


/**
 * @return {!lfpug.model.ArrayCollection} The tasks associated with this story.
 */
lfpug.model.Story.prototype.getTasks = function() {
  return this.tasks_;
};


/**
 * @type {!string}
 * @private
 */
lfpug.model.Story.prototype.description_ = '';


/**
 * @type {!string}
 * @private
 */
lfpug.model.Story.prototype.name_ = '';


/**
 * @return {!string} The Description of the model.
 */
lfpug.model.Story.prototype.getDescription = function() {
  return this.description_;
};


/**
 * @param {!string} value The description of the model.
 */
lfpug.model.Story.prototype.setDescription = function(value) {
  this.description_ = value;
};


/**
 * @param {!string} value Setter for name.
 */
lfpug.model.Story.prototype.setName = function(value) {
  this.name_ = value;
};


/**
 * @return {!string} The models name property.
 */
lfpug.model.Story.prototype.getName = function() {
  return this.name_;
};


